package com.zmx.doctor.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.doctor.R;
import com.zmx.doctor.pojo.AddressList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 程序猿：胖胖祥
 * 时 间：2021/3/26  10:24
 * 功 能：
 */

public class AddressListAdapter extends BaseAdapterRvList<AddressListAdapter.ViewHolder, AddressList> {

    public AddressListAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, AddressList addressList) {

        holder.name.setText(addressList.getName());
        holder.address.setText(addressList.getProvince()+addressList.getCounty()+addressList.getCity()+addressList.getStreet());
        holder.phone.setText(addressList.getPhone());

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {
        ViewHolder holder = new ViewHolder(inflater.inflate(R.layout.adapter_address_list, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.phone)
        TextView phone;
        @BindView(R.id.address)
        TextView address;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }

}
